package cn.kga.gl.test2;

import java.io.File;
import java.util.List;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

public class Test02 {
	public static void main(String[] args) throws DocumentException {
		SAXReader sr=new SAXReader();
		Document doc=sr.read(new File("person2.xml"));
		//得到根元素
		Element yeye=doc.getRootElement();
		//得到儿子
		List<Element> list=yeye.elements();
		//遍历单个儿子
		for(Element erzi:list){
			List<Element> list1=erzi.elements();
			for(Element sunzi :list1){
				System.out.println(sunzi.getName()+"---"+sunzi.getText());
			}
		}
		
	}
}
